package com.newlink.building.userinfo.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.newlink.building.common_base.model.bean.AuthResponseBody
import com.newlink.building.common_base.utils.NLog
import com.newlink.building.userinfo.R

/**
 * @author wangyang
 * @date 2022/9/19
 * @description 我的——消息中心页面的Adapter
 */
class Module_UserInfo_FaceDataAdapter(data: MutableList<AuthResponseBody>) :
    BaseQuickAdapter<AuthResponseBody, BaseViewHolder>(R.layout.item_face_data, data),
    LoadMoreModule {

    var mOnDeleteClickListener: OnDeleteClickListener? = null

    fun setOnDeleteClickListener(listener: OnDeleteClickListener) {
        mOnDeleteClickListener = listener
    }

    override fun convert(holder: BaseViewHolder, item: AuthResponseBody) {
        holder.getView<ImageView>(R.id.auth_face_del).setOnClickListener {
            NLog.e("[jake]........ 人脸删除按钮被点击")
            mOnDeleteClickListener?.onDeleteClick(item)
        }
        val name = item.keyName.ifEmpty { "unknown" }
        holder.setText(R.id.tv_face_data, name)

//        GlideApp.with(context).load(item.keyInfo).into(holder.getView(R.id.iv_face_data))
    }

    interface OnDeleteClickListener {
        fun onDeleteClick(item: AuthResponseBody)
    }
}